import xlwings as xw
from xlwings.utils import rgb_to_int

VISIBLE = True  # 界面是否可见

app = xw.App(visible=VISIBLE, add_book=False)  # 界面设置
app.display_alerts = VISIBLE  # 提示信息
app.screen_updating = VISIBLE  # 显示更新
wb = app.books.add()  # 新建工作簿
sht = wb.sheets.active  # 实例化工作表

'''初始化样式'''
sht.range('A1', 'XFD1048576').api.Font.Name = '微软雅黑'  # 字体
sht.range('A1', 'XFD1048576').api.Font.Size = 12  # 字号
# sht.range('A1', 'XFD1048576').row_height  = 10  # 行高=1像素
# sht.range('A1', 'XFD1048576').column_width = 10  # 列宽=6.107像素
for i in [7, 8, 9, 10, 11, 12]:
    sht.range('A1', 'XFD1048576').api.Borders(i).LineStyle = 1  # 边框线型为实线
    sht.range('A1', 'XFD1048576').api.Borders(i).Weight = 2  # 边框粗细为细长
    sht.range('A1', 'XFD1048576').api.Borders(i).Color = rgb_to_int((255, 255, 255))  # 边框颜色为白色

'''此处编写逻辑代码'''

'''此处编写逻辑代码'''

sht.autofit()  # 自动调整
input('Enter to quit')
wb.save('result.xlsx')
wb.close()
